package cn.chenhongchao.zhaobiaopingtai.controller;

import cn.chenhongchao.zhaobiaopingtai.common.api.CommonPage;
import cn.chenhongchao.zhaobiaopingtai.common.api.CommonResult;
import cn.chenhongchao.zhaobiaopingtai.dto.ReturnBidDTO;
import cn.chenhongchao.zhaobiaopingtai.dto.TenderDTO;
import cn.chenhongchao.zhaobiaopingtai.entity.ReturnBid;
import cn.chenhongchao.zhaobiaopingtai.service.impl.BidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.TenderServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/tenderEvaluationBusiness")
@CrossOrigin
public class TenderEvaluationBusinessController {

    @Autowired
    private BidServiceImpl bidService;
    @Autowired
    private TenderServiceImpl tenderService;

    @RequestMapping("getTenderEvaluationBusiness")
    public CommonResult getTenderReturn(@RequestParam(value = "page", required = false) Integer pageNum,
                                        @RequestParam(value = "size", required = false) Integer pageSize
                                        ) {
        if (pageNum == null) {
            pageNum = 1;
        }

        if (pageSize == null) {
            pageSize = 10;
        }

//        CommonPage<ReturnBid> returnBidCommonPage = bidService.getTenderEvaluation(pageNum, pageSize, returnBidDTO);
        CommonPage<TenderDTO> list = (CommonPage<TenderDTO>) tenderService.getTenderEvaluation(pageNum, pageSize);
        return CommonResult.success(list);
    }
}
